import { Component, OnInit } from '@angular/core';
import {ExtendHttpService} from "../../services/extend-http.service";
import {Router} from "@angular/router";
import {SocketService} from "../../services/socket.service";

@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrls: ['./header.component.css']
})
export class HeaderComponent implements OnInit {

  show = false;
  constructor(
    private extendHttp: ExtendHttpService,
    private router: Router,
    private socketService: SocketService
  ) { }

  ngOnInit() {
  }

  changShow(){
    this.show=!this.show;
  }

  changePwd() {
    this.extendHttp.get('/agentApp/login/exit', {}).subscribe(response => {
      let data = response.json();
      if (data.code == '0') {
        this.socketService.wsClose();
        this.router.navigate(['/login']);
      } else {

      }
    }, error => {
      this.router.navigate(['/login']);
    });
  }

}
